﻿using HK.Core.GUIEx.Protocol.Attribute;
using HK.Core.Serializable.Protocol.Attribute;
using HK.Core.Utils;

namespace HK.Core.Serializable.Attribute
{
    /// <summary>
    /// Attribute - 日期
    /// </summary>
    public class DateTimeAttribute : GenericFieldAttribute, IDateTimeAttribute
    {
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="iCaption">标题</param>
        /// <param name="iFormat">日期格式</param>
        /// <param name="iIcon">Icon</param>
        /// <param name="iTips">提示</param>
        /// <param name="iOptions">选项</param>
        public DateTimeAttribute(string iCaption, UtilsTime.DateFormat iFormat = UtilsTime.DateFormat.YyyyMmDdHhMmSs, 
            string iIcon = null, string iTips = null, int iOptions = (int)GUIOperateOptions.DateTime) :
            base(iCaption, iIcon, iTips, iOptions)
        {
            Format = iFormat;
        }
        
        /// <summary>
        /// 保护构造函数
        /// </summary>
        private DateTimeAttribute() : base() {}

        /// <summary>
        /// 可编辑
        /// </summary>
        public override bool Editable => false;
        
        /// <summary>
        /// 日期格式
        /// </summary>
        public UtilsTime.DateFormat Format { get; private set; } = UtilsTime.DateFormat.YyyyMmDdHhMmSs;
    }
}